package com.cloud.redis.controller;

import com.cloud.redis.Entity.User;
import com.cloud.redis.service.TestService;
import com.lwj.framework.constant.Constant;
import com.lwj.redislock.RedissonManager;
import com.lwj.redislock.annotation.DistributedLock;
import com.lwj.redislock.config.RedissonAutoConfiguration;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.redisson.Redisson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletRequest;


/**
 * @Author: :lwj
 * @Time: 2018-10-21 18:40
 * @Feature:
 */

@Api(tags ="测试")
@Controller
public class TestController {
    @Autowired
    private TestService testService;
    /**
     * @return
     */
    @ApiOperation(value = "test")
    @GetMapping("/test")
    public ResponseEntity<User> user(HttpServletRequest request){
        User user = testService.getUser();
        return ResponseEntity.ok(user);
    }

    /**
     * @return
     */
    @ApiOperation(value = "testLock")
    @GetMapping("/testLock")
    public ResponseEntity<String> testLock(HttpServletRequest request){
        String s = testService.testLock();
        return ResponseEntity.ok(s );
    }

}
